package com.example.demo.timer;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;

/**
 * Created on 2019/9/13.
 *
 * @author Grak
 * @since 1.0
 */
@Component
public class DealHave {

    @Async
    public Future<String> dealHve(){
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("执行3秒");

        return new AsyncResult<String>("异步调用返回");
    }
}
